//
//  BalanceDetailTableViewCell.swift
//  ZNZXSuperMarket
//
//  Created by 四川中农 on 2018/8/7.
//  Copyright © 2018年 四川中农. All rights reserved.
//
//111
import UIKit

class BalanceDetailTableViewCell: UITableViewCell {
    
    @IBOutlet weak var orderNumber: UILabel!
    @IBOutlet weak var orderType: UILabel!
    @IBOutlet weak var timeLabel: UILabel!
    @IBOutlet weak var detail: UILabel!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    func reload(withModel model:UserMoneyModel){
        self.orderNumber.text = "订单号：" + model.orderNo
        //0充值 1消费 2归还欠款 3订单找零 4 订单退款
        var title = ""
        var str = "-"
        switch model.type {
        case 0:
            title = "线上充值成功"
            str = "+"
            self.detail.textColor = UIColor.init(hexColor: "#010101")
        case 1:
            title = "账户支付成功"
            str = "-"
            self.detail.textColor = UIColor.init(hexColor: "#ed4848")
        case 2:
            title = "归还欠款"
            str = "-"
            self.detail.textColor = UIColor.init(hexColor: "#ed4848")
        case 3:
            title = "订单找零"
            str = "+"
            self.detail.textColor = UIColor.init(hexColor: "#010101")
        case 4:
            title = "订单退款"
            str = "+"
            self.detail.textColor = UIColor.init(hexColor: "#010101")
        default:
            break
        }
        self.orderType.text = title
        
        self.detail.attributedText = Utils.changeLabelTextFontSize(normalString: str + "￥" + model.money, changeString: model.money.getPriceInteger(), font: UIFont.systemFont(ofSize: 16))
        self.timeLabel.text = model.createTime.timeStampToString(timeFormat: "YYYY-MM-dd HH:mm:ss")
    }

}
